package com.javastudy;

import java.util.Scanner;

import org.junit.Test;

public class Test_object {
	public class Student{
		int id;
		String name;
		int age;
		String className;
		
		String  getname(int id){
			return this.name;
		}

		@Override
		public String toString() {
			return "Student [id=" + id + ", name=" + name + ", age=" + age + ", className=" + className + "]";
		}
		
		
	}
	public class Teacher{
		int  id;
		String name;
		int age;
		String courseName;
		String className;
	}
	
	
//	@Test
/*	public void Test01(){
		System.out.println("请输入学生人数：");
		Scanner input = new Scanner(System.in);
		int num = input.nextInt();
		Student[] students = new Student[num];
		for (int i = 0; i < students.length; i++) {
			//Student student =  students[i];
			Student student = new Student();
			System.out.println("请输入学生ID：");
			student.id = input.nextInt();
			System.out.println("请输入学生姓名：");
			student.name = input.next();
			System.out.println("请输入年级：");
			student.age = input.nextInt();
			System.out.println("请输入班级名称：");
			student.className = input.next();
			students[i] = student;
			
		}
		for (int i = 0; i < students.length; i++) {
			Student student = students[i];
			System.out.println("ID:"+student.id);
			System.out.println("请输入id");
			System.out.println(student.getname(input.nextInt()));
		}
	}*/
	@Test
	public void rewrite(){
		System.out.println("请输入学生数量：");
		Scanner input  = new  Scanner(System.in);
		int student_num = input.nextInt();
		Student[] students = new Student[student_num];
		for (int i = 0; i < students.length; i++) {
			Student student = new Student();
			System.out.println("请输入学生ID：");
			student.id = input.nextInt();
			System.out.println("请输入学生新姓名：");
			student.name = input.next();
			System.out.println("请输入学生年龄：");
			student.age = input.nextInt();
			System.out.println("请输入学生班级：");
			student.className = input.next();
			students[i] = student;
		}
		for (int i = 0; i < students.length; i++) {
			System.out.println(students[i]);

		}
	}
}
